package com.vladimirkolarevic.eventplanner.beans;

import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

import org.hibernate.annotations.GenericGenerator;
import org.springframework.jmx.export.annotation.ManagedOperationParameter;

import com.vladimirkolarevic.eventplanner.Attend;
import com.vladimirkolarevic.eventplanner.Event;
import com.vladimirkolarevic.eventplanner.User;

@Entity
public class AttendBean implements Serializable,Attend {

	@Id
	@GeneratedValue(strategy=GenerationType.SEQUENCE)
	private Long id;
	
	
	@OneToOne(cascade=CascadeType.ALL,targetEntity=UserBean.class)
	private User user;
	
	@ManyToMany(cascade=CascadeType.ALL,targetEntity=EventBean.class)
	private List<Event> events = new LinkedList<Event>();
	
	
	public AttendBean() {
		// TODO Auto-generated constructor stub
	}
	
	public void addEvent(Event event) {
		// TODO Auto-generated method stub
		events.add(event);
	}

	public List<Event> getEvents() {
		// TODO Auto-generated method stub
		return events;
	}

	public Long getId() {
		// TODO Auto-generated method stub
		return id;
	}

	public User getUser() {
		// TODO Auto-generated method stub
		return user;
	}

	public void setEvents(List<Event> events) {
		// TODO Auto-generated method stub
		this.events = events;

	}

	public void setUser(User user) {
		this.user = user;
	}

	
	
}
